package com.yq.backend.controller;

import com.yq.backend.dto.CardGameDto;
import com.yq.backend.pojo.CardGame;
import com.yq.backend.pojo.CardGameProduct;
import com.yq.backend.pojo.CardGameRules;
import com.yq.backend.pojo.Result;
import com.yq.backend.service.CardGameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @descriptions: 活动管理
 * @author: yunqiang
 * @date: 2022/5/3 11:27
 */
@Api(tags = {"活动管理：活动管理控制类"})
@RestController
@RequestMapping("/api/v1/cardGame")
public class CardGameController {

    @Autowired
    private CardGameService cardGameService;


    @ApiOperation(value = "活动列表")
    @PostMapping("/getCardGames")
    public Result getCardGames(@RequestBody CardGameDto cardGameDto) { return this.cardGameService.getCardGames(cardGameDto); }

    @ApiOperation(value = "添加活动")
    @PostMapping("/addCardGame")
    public Result addCardGame(@RequestBody CardGame cardGame) {
        return this.cardGameService.addCardGame(cardGame);
    }

    @ApiOperation(value = "修改活动")
    @PostMapping("/upCardGame")
    public Result upCardGame(@RequestBody CardGame cardGame) {
        return this.cardGameService.upCardGame(cardGame);
    }

    @ApiOperation(value = "删除活动")
    @GetMapping("/delCardGame/{id}")
    public Result delCardGameById(@PathVariable Integer id) {
        return this.cardGameService.delCardGameById(id);
    }

    @ApiOperation(value = "根据id查询活动")
    @GetMapping("/cardGame/{id}")
    public Result getCardGameId(@PathVariable Integer id) {
        return this.cardGameService.getCardGameId(id);
    }

    @ApiOperation(value = "奖品配置列表")
    @PostMapping("/getPrizeAllocations")
    public Result getPrizeAllocations() { return this.cardGameService.getPrizeAllocations(); }

    @ApiOperation(value = "添加奖品")
    @PostMapping("/addPrizeAllocation")
    public Result addPrizeAllocation(@RequestBody CardGameProduct cardGameProduct) {
        return this.cardGameService.addPrizeAllocation(cardGameProduct);
    }

    @ApiOperation(value = "修改奖品")
    @PostMapping("/upPrizeAllocation")
    public Result upPrizeAllocation(@RequestBody CardGameProduct cardGameProduct) {
        return this.cardGameService.upPrizeAllocation(cardGameProduct);
    }

    @ApiOperation(value = "删除奖品")
    @GetMapping("/delPrizeAllocation/{id}")
    public Result delPrizeAllocation(@PathVariable Integer id) {
        return this.cardGameService.delPrizeAllocation(id);
    }

    @ApiOperation(value = "根据id查询活动奖品")
    @GetMapping("/prizeAllocation/{id}")
    public Result getPrizeAllocationId(@PathVariable Integer id) {
        return this.cardGameService.prizeAllocation(id);
    }

    @ApiOperation(value = "活动策略列表")
    @PostMapping("/getupStrategys")
    public Result getupStrategys() { return this.cardGameService.getupStrategys(); }

    @ApiOperation(value = "添加活动策略")
    @PostMapping("/addupStrategy")
    public Result addupStrategy(@RequestBody CardGameRules cardGameRules) {
        return this.cardGameService.addupStrategy(cardGameRules);
    }

    @ApiOperation(value = "修改活动策略")
    @PostMapping("/upStrategy")
    public Result upStrategy(@RequestBody CardGameRules cardGameRules) {
        return this.cardGameService.upStrategy(cardGameRules);
    }

    @ApiOperation(value = "删除活动策略")
    @GetMapping("/delStrategy/{id}")
    public Result delStrategy(@PathVariable Integer id) {
        return this.cardGameService.delStrategy(id);
    }

    @ApiOperation(value = "根据id查询活动策略")
    @GetMapping("/Strategy/{id}")
    public Result getStrategyId(@PathVariable Integer id) {
        return this.cardGameService.getStrategyId(id);
    }
}
